import request from '@/utils/request'

//  根据项目id查询劳务公司以及劳务公司下的班组
export function getTree(id) {
    return request({
        url: `/project/service-corporation/treeByProjectId`,
        method: 'get',
        params:{}
    })
}

export function getPersonByTeamId(data) {
    return request({
        url: `/personnel/belong/team/person`,
        method: 'get',
        params: data

    })
}

export function getPersonByserviceCorporationId(data) {
    return request({
        url: `/personnel/belong/service_corporation/person`,
        method: 'get',
        params: data

    })
}
// 根据项目id获取劳务公司列表
export function getServiceCorporation(data) {
    return request({
        url: `/project/service-corporation/listByProjectId`,
        method: 'get',
        params: data
    })
}
// 获取工种列表
export function getWorkType(info) {
    return request({
        url: `/personnel/work-type/list`,
        method: 'get',
        params: info
    })
}
// 新增人员
export function insertPersonnel(info) {
    return request({
        url: `/personnel/person/addPerson`,
        method: 'post',
        data: info
    })
}
//删除人员
export function deletePersonnel(ids) {
    return request({
        url: `/personnel/person/deletePerson`,
        method: 'post',
        data: ids
    })
}
// 添加/修改工种
export function updateOrInsertWorkType(info) {
    return request({
        url: `/personnel/work-type/updateOrInsert`,
        method: 'post',
        params: info
    })
}
// 删除工种
export function deleteWorkType(id) {
    return request({
        url: `/personnel/work-type/delete`,
        method: 'post',
        params: {
            id: id
        }
    })
}
// 根据id查询人员信息
export function getPersonnelById(id) {
    return request({
        url: `/personnel/person/detail`,
        method: 'get',
        params: {
            person_id: id
        }
    })
}
// 修改人员信息
export function updatePersonnel(info) {
    return request({
        url: `/personnel/person/update`,
        method: 'post',
        data: info
    })
}
//快速建档列表
export function quickFillingList(currentPage, pageSize) {
    return request({
        url: `/personnel/person/quickFilling/list`,
        method: 'get',
        params: { currentPage, pageSize }
    })
}
// 退场
export function personExit(data) {
    return request({
        url: `/personnel/person/exit`,
        method: 'post',
        data: data
    })
}
//导出人员列表
export function exportPersonInf() {
    return request({
        url: `/personnel/person/exportPersonInf`,
        responseType : 'blob',
        method: 'get',
    })
}